﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AllRoles.aspx.cs" Inherits="SoftwareDiscipline.SharePoint.UserManagement.Layouts.Sword.AllRoles" DynamicMasterPageFile="~masterurl/default.master" %>
<%@ Register TagName="ToolBar" TagPrefix="wssuc" Src="~/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" Src="~/_controltemplates/ToolBarButton.ascx" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<script language="javascript" type="text/javascript">
    function OpenDialog(url) {
        var options = SP.UI.$create_DialogOptions();
        options.url = url;
        options.width = 600;
        options.height = 180;
        options.dialogReturnValueCallback = Function.createDelegate(null, OnCloseDialog);
        SP.UI.ModalDialog.showModalDialog(options);
    }

    function OnCloseDialog() {
        window.location = location.href;
    }
    </script>

</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<asp:ObjectDataSource runat="server" TypeName="SoftwareDiscipline.SharePoint.UserManagement.Data.AllRolesDataSource,$SharePoint.Project.AssemblyFullName$"
        SelectCountMethod="GetCount" SelectMethod="GetAllRoles" ID="allRolesDataSource" 
        EnablePaging="true" StartRowIndexParameterName="startRow" MaximumRowsParameterName="pageSize">
    </asp:ObjectDataSource>

    <wssuc:ToolBar runat="server" ID="gridToolBar">
        <Template_Buttons>
            <wssuc:ToolBarButton ID="ToolBarButton1" runat="server" CommandName="NewRole" CommandArgument="" Text="<%$Resources:swusrmgmt, AllRoles_ToolBar_NewRoleText %>"
                ToolTip="<%$Resources:swusrmgmt, AllRoles_ToolBar_NewRoleTooltip %>"
                NavigateUrl="javascript:OpenDialog('NewRole.aspx')" />
        </Template_Buttons>
    </wssuc:ToolBar>
 
  <SharePoint:MenuTemplate runat="server" ID="gvRoleItemMenuTemplate">
        <SharePoint:MenuItemTemplate ID="itemTemplateEditProperties" runat="server" Text="<%$Resources:swusrmgmt, AllRoles_GridView_RolesMenu_EditProperties %>"
            ClientOnClickScript="javascript:OpenDialog('EditRoles.aspx?RoleName=%RoleName%')" Visible="false" />
        <SharePoint:MenuItemTemplate ID="itemTemplateDelete" runat="server" Text="<%$Resources:swusrmgmt, AllRoles_GridView_RolesMenu_DeleteItem %>"
            ClientOnClickNavigateUrl="#" ClientOnClickPostBackConfirmation="<%$Resources:swusrmgmt, AllRoles_GridView_ConfirmDeleteItem %>"
            ClientOnClickUsingPostBackEvent="__page,DELETE,%RoleName%" />
        <SharePoint:MenuSeparatorTemplate ID="MenuSeparatorTemplate1" runat="server" /> 
        <SharePoint:MenuItemTemplate ID="itemTemplateViewUsers" runat="server" Text="<%$Resources:swusrmgmt, AllRoles_GridView_RolesMenu_AllUsers %>"
            ClientOnClickNavigateUrl="AllUsers.aspx?Role=%RoleName%" Visible="true" />        
    </SharePoint:MenuTemplate>

    <SharePoint:SPGridView runat="server" ID="gvAllRoles" AutoGenerateColumns="false" 
        AllowSorting="true" AllowFiltering="true" 
        AllowPaging="true" PageSize="20"
        DataSourceID="allRolesDataSource"  >       
        <Columns>
            <SharePoint:SPMenuField MenuTemplateId="gvRoleItemMenuTemplate" TextFields="RoleName"
                HeaderText="<%$Resources:swusrmgmt, AllRoles_GridView_RoleName %>"  
                TokenNameAndValueFields="RoleName=RoleName"                  
                 />            
        </Columns>
    </SharePoint:SPGridView>
    <SharePoint:SPGridViewPager runat="server" ID="gridPager" GridViewId="gvAllRoles">
    </SharePoint:SPGridViewPager>

</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
<asp:Literal ID="Literal3" runat="server" Text="<%$Resources:swusrmgmt, AllRoles_PageTitle %>" />
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
<asp:Literal ID="Literal1" runat="server" Text="<%$Resources:swusrmgmt, AllRoles_PageTitle %>" />
</asp:Content>
